package com.huawei.appmarket.component.feedback.activity;

import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import java.util.List;
import o.dfg;
import o.dfj.e;
import o.eqx;

public class FeedbackShowImageAdapter extends BaseAdapter {
    private Context context;
    private List<dfg> imageList;
    private Handler myHandler;

    class a implements OnClickListener {
        private b ˎ;
        final /* synthetic */ FeedbackShowImageAdapter ॱ;

        public a(FeedbackShowImageAdapter feedbackShowImageAdapter, b bVar) {
            this.ॱ = feedbackShowImageAdapter;
            this.ˎ = bVar;
        }

        public void onClick(View view) {
            int intValue = ((Integer) this.ˎ.ˊ.getTag()).intValue();
            if (intValue < this.ॱ.imageList.size()) {
                this.ॱ.imageList.remove(intValue);
                this.ॱ.myHandler.sendEmptyMessage(1001);
            }
        }
    }

    static class b {
        public Button ˊ;
        public ImageView ˏ;

        private b() {
        }
    }

    public FeedbackShowImageAdapter(List<dfg> list, Context context, Handler handler) {
        this.imageList = list;
        this.context = context;
        this.myHandler = handler;
    }

    public int getCount() {
        return this.imageList.size();
    }

    public Object getItem(int i) {
        return this.imageList.get(i);
    }

    public long getItemId(int i) {
        return (long) i;
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        b bVar;
        if (view == null) {
            view = LayoutInflater.from(this.context).inflate(o.dfj.b.ॱ, null);
            bVar = new b();
            bVar.ˏ = (ImageView) view.findViewById(o.dfj.a.ᐝ);
            bVar.ˊ = (Button) view.findViewById(o.dfj.a.ʼ);
            view.setTag(bVar);
        } else {
            bVar = (b) view.getTag();
        }
        dfg o_dfg = (dfg) this.imageList.get(i);
        if (viewGroup != null && viewGroup.getChildCount() == i) {
            if (o_dfg == null) {
                bVar.ˏ.setImageDrawable(this.context.getResources().getDrawable(e.ˏ));
                bVar.ˊ.setVisibility(8);
            } else {
                eqx.ˎ(bVar.ˏ, o_dfg.ˎ().toString());
                bVar.ˊ.setVisibility(0);
                bVar.ˊ.setTag(Integer.valueOf(i));
                bVar.ˊ.setOnClickListener(new a(this, bVar));
            }
        }
        return view;
    }
}
